package com.ovopark.organize.server.model.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
 * 加盟商 商业立项模版 动态字段
 *
 */
@Data
@TableName("is_franchisees_approval_template_field")
public class FranchiseesApprovalTemplateField implements Serializable {

	@TableId(value = "id", type = IdType.AUTO)
	private Integer id;
	// 控件名称
	private String fieldName;
	// 分组id
	private Integer sectionId;
	// 控件类型 radio单选 checkbox多选 select下拉框 input输入框 textarea文本框 multipleBlank多选填空
	private String fieldType;
	// 排序
	private Integer sort;
	// 是否必填
	private Integer isRequired;
	// 1删除0正常
	private Integer isDeleted;
	// 版本信息
	private String version;
	// 最少要选
	private Integer minSelect;
	// 最多可选
	private Integer maxSelect;
	@TableField(exist = false)
	private List<FranchiseesApprovalTemplateFieldSelect> fieldSelectList;
	// 选择id
	@TableField(exist = false)
	private String value;
	// 选项值
	@TableField(exist = false)
	private String valueName;
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		FranchiseesApprovalTemplateField other = (FranchiseesApprovalTemplateField) obj;
		if (fieldName == null) {
			if (other.fieldName != null)
				return false;
		} else if (!fieldName.equals(other.fieldName))
			return false;
		if (fieldType == null) {
			if (other.fieldType != null)
				return false;
		} else if (!fieldType.equals(other.fieldType))
			return false;
		if (sort == null) {
			if (other.sort != null)
				return false;
		} else if (!sort.equals(other.sort))
			return false;
		if (isRequired == null) {
            return other.isRequired == null;
		} else return isRequired.equals(other.isRequired);
    }

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((fieldName == null) ? 0 : fieldName.hashCode());
		result = prime * result + ((fieldType == null) ? 0 : fieldType.hashCode());
		result = prime * result + ((sort == null) ? 0 : sort.hashCode());
		result = prime * result + ((isRequired == null) ? 0 : isRequired.hashCode());
		return result;
	}
}
